#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=10010;
char num_seg[maxn][9]= {0};
bool cmp(int pos1,int pos2)
{
    char pos1topos2[18]= {0},po2topos1[18]= {0};
    strcat(pos1topos2,num_seg[pos1]);
    strcat(pos1topos2,num_seg[pos2]);
    strcat(po2topos1,num_seg[pos2]);
    strcat(po2topos1,num_seg[pos1]);
    return strcmp(pos1topos2,po2topos1)<0;
}
int main_1038_1()
{
    int N;
    scanf("%d",&N);
    getchar();
    int num_pos[maxn]= {0};
    for (int i=0; i<N ; ++i )
    {
        scanf("%s",num_seg[i]);
        num_pos[i]=i;
    }
    sort(num_pos,num_pos+N,cmp);
    char str[N*9]={0};
    for (int j=0;j<N ;++j )
    {
        strcat(str,num_seg[num_pos[j]]);
    }
    int k;
    for (k=0; str[k]=='0'&&k<strlen(str); ++k)
    {

    }
    if (k==strlen(str))
    {
        printf("0");
    }
    else
    {
        for (int i=k; i<strlen(str);++i )
        {
            printf("%c",str[i]);
        }
    }
    return 0;
}
